package com.icinfo.cloud.provider.punish.api.controller;

import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.api.dto.*;
import com.icinfo.cloud.provider.punish.api.service.ICaseInfoShareService;
import com.icinfo.cloud.provider.punish.api.vo.*;
import com.icinfo.cloud.provider.punish.config.dto.ConfigDictionaryInfoQueryDto;
import com.icinfo.cloud.provider.punish.config.service.IConfigDictionaryInfoService;
import com.icinfo.cloud.provider.punish.config.vo.ConfigDictionaryInfoVo;
import com.icinfo.framework.common.web.Result;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 * 描述：对外部提供的获取案件信息Controller (执法平台)
 * @author shishengyao
 * @description
 * @date 2022/7/18
 */
@RestController
@RequestMapping("/punish/ucase/case/info/share")
public class CaseInfoShareController {
    @Resource
    private ICaseInfoShareService caseInfoShareService;
    @Resource
    private IConfigDictionaryInfoService configDictionaryInfoService;

    /**
     * 【V1.3.2】描述：根据办案人员id获取办案中的案件列表
     *
     * @param pageQueryDto 页面查询dto
     * @return {@link PageResponse<CaseInfoShareVo> }
     * @author shishengyao
     * @date 2022/07/18
     */
    @PostMapping(value = "/getCaseInfoList")
    @ApiOperation(value = "【V1.3.2】描述：根据办案人员id获取办案中的案件列表", httpMethod = "GET")
    public PageResponse<CaseInfoShareVo> getCaseInfoList(@Validated @RequestBody CaseInfoSharePageQueryDto pageQueryDto){
        List<CaseInfoShareVo> caseInfoPageList = caseInfoShareService.getCaseInfoPageList(pageQueryDto);
        return new PageResponse<>(caseInfoPageList);
    }

    /**
     * 【V1.3.2】描述：获取案件当事人信息
     *
     * @param caseId 用例id
     * @return {@link List<CasePartyInfoShareVo> }
     * @author shishengyao
     * @date 2022/07/18
     */
    @GetMapping(value = "/getCasePartyList")
    @ApiOperation(value = "【V1.3.2】描述：根据案件id获取获取案件当事人信息列表", httpMethod = "GET")
    public Result<List<CasePartyInfoShareVo>> getCasePartyList(@Param("caseId") String caseId){
        List<CasePartyInfoShareVo> casePartList= caseInfoShareService.getCasePartyListByCaseId(caseId);
        return Result.success(casePartList);
    }


    /**
     * 描述： 根据承办人查询案件记录(分页)
     *
     * @author: zhengqiang
     * @date: 2022/9/7
     * @param: pageQueryDto
     * @return {@link PageResponse<  CaseInfoRecordVo >}
     **/
    @PostMapping(value = "/getCaseInfoListByUser")
    public PageResponse<CaseInfoRecordVo> getCaseInfoListByUser(@Validated @RequestBody CaseInfoRecordPageQueryDto pageQueryDto){
        List<CaseInfoRecordVo> caseInfoPageList = caseInfoShareService.getCaseInfoListByUser(pageQueryDto);
        return new PageResponse<>(caseInfoPageList);
    }

    /**
     * 描述： 根据类型获取字典列表
     *
     * @author: zhengqiang
     * @date: 2022/9/8
     * @param: queryDto
     * @return {@link Result< List< ConfigDictionaryInfoVo>>}
     **/
    @PostMapping("/getConfigDictionaryListForOutSys")
    public Result<List<ConfigDictionaryInfoVo>> getConfigDictionaryListForOutSys(@RequestBody @Validated ConfigDictionaryInfoQueryDto queryDto) {
        List<ConfigDictionaryInfoVo> configDictionaryInfoList = configDictionaryInfoService.getConfigDictionaryList(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, configDictionaryInfoList);
    }


    /**
     * 描述： 根据案件id获取分当事人案件详情 (事项抄告调用)
     *
     * @author: zhengqiang
     * @date: 2022/10/19
     * @param: caseId
     * @return {@link Result< List< PartiesCaseInfoOfExtVo>>}
     **/
    @GetMapping("/getPartiesCaseInfoByCaseIdOfExt")
    public Result<List<PartiesCaseInfoOfExtVo>> getPartiesCaseInfoByCaseIdOfExt(@Param("caseId") String caseId){
        List<PartiesCaseInfoOfExtVo> partiesCaseInfoList = caseInfoShareService.getPartiesCaseInfoByCaseIdOfExt(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, partiesCaseInfoList);
    }

    /**
     * 描述： 根据办案人员获取办案中的案件记录(分页)
     *
     * @author: zhengqiang
     * @date: 2022/10/19
     * @param: pageQueryDto
     * @return {@link PageResponse< CaseInfoRecordOfExtVo>}
     **/
    @PostMapping("/getCaseInfoPageRecordByUserOfExt")
    public PageResponse<CaseInfoRecordOfExtVo> getCaseInfoPageRecordByUserOfExt(@Validated @RequestBody CaseInfoRecordPageQueryOfExtDto pageQueryDto){
        List<CaseInfoRecordOfExtVo> caseInfoPageList = caseInfoShareService.getCaseInfoPageRecordByUserOfExt(pageQueryDto);
        return new PageResponse<>(caseInfoPageList);
    }

    /**
     * 描述： 根据办案人员获取办案中的案源记录(分页)
     *
     * @author: zhengqiang
     * @date: 2023/02/20
     * @param: pageQueryDto
     * @return {@link PageResponse< CaseSourceInfoRecordOfExtVo>}
     **/
    @PostMapping("/getCaseSourceInfoPageRecordByUserOfExt")
    public PageResponse<CaseSourceInfoRecordOfExtVo> getCaseSourceInfoPageRecordByUserOfExt(@Validated @RequestBody CaseSourceInfoRecordPageQueryOfExtDto pageQueryDto){
        List<CaseSourceInfoRecordOfExtVo> caseInfoPageList = caseInfoShareService.getCaseSourceInfoPageRecordByUserOfExt(pageQueryDto);
        return new PageResponse<>(caseInfoPageList);
    }

    /**
     * 描述： 根据案件id获取案件记录 (联合会商、争议裁决调用)
     *
     * @author: zhengqiang
     * @date: 2022/10/19
     * @param: caseId
     * @return {@link Result< CaseInfoRecordOfExtVo>}
     **/
    @GetMapping("/getCaseInfoRecordByCaseIdOfExt")
    public Result<CaseInfoRecordOfExtVo> getCaseInfoRecordByCaseIdOfExt(@Param("caseId") String caseId){
        CaseInfoRecordOfExtVo caseInfoRecord = caseInfoShareService.getCaseInfoRecordByCaseIdOfExt(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseInfoRecord);
    }

    /**
     * 描述： 根据主体身份证或代码社会信用代码查询处罚记录(分页) (信息协助)
     *
     * @author: zhengqiang
     * @date: 2022/10/19
     * @param: pageQueryDto
     * @return {@link PageResponse< PartiesPunishRecordOfExtVo>}
     **/
    @PostMapping("/getPartiesPunishPageRecordByIdCodeOfExt")
    public PageResponse<PartiesPunishRecordOfExtVo> getPartiesPunishPageRecordByIdCodeOfExt(@Validated @RequestBody PartiesPunishRecordPageQueryOfExtDto pageQueryDto){
        List<PartiesPunishRecordOfExtVo> partiesPunishRecord = caseInfoShareService.getPartiesPunishRecordByIdCodeOfExt(pageQueryDto);
        return new PageResponse<>(partiesPunishRecord);
    }


    /**
     * 描述： 根据案件id查询处罚决定信息
     *
     * @author: zhengqiang
     * @date: 2023/3/1
     * @param: caseId
     * @return {@link Result< CasePunishDecisionInfoVo>}
     **/
    @GetMapping("/getCasePunishDecisionInfoByCaseId")
    public Result<List<CasePunishDecisionInfoVo>> getCasePunishDecisionInfoByCaseId(@Param("caseId") String caseId){
        List<CasePunishDecisionInfoVo> casePunishDecisionInfoByCaseId = caseInfoShareService.getCasePunishDecisionInfoByCaseId(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, casePunishDecisionInfoByCaseId);
    }
    /**
     * 根据caseId获取案件条线信息与案文书抬头
     * @author liyafeng
     * @date 2023/3/8
      * @param caseId
     * @return {@link Result< CaseLineStandardNameInfoVo>}
     */
    @GetMapping("/getCaseLineStandardNameInfo")
    public Result<CaseLineStandardNameInfoVo> getCaseLineStandardNameInfo(@Param("caseId") String caseId){
        CaseLineStandardNameInfoVo  vo = caseInfoShareService.getCaseLineStandardNameInfo(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    /**
     * 描述： 根据检查id查询案件信息列表
     *
     * @author: zhengqiang
     * @date: 2023/3/7
     * @param: checkIds
     * @return {@link Result< CheckTransferCaseRecordVo>}
     **/
    @GetMapping("/getCheckTransferCaseListByCheckIds")
    public Result<List<CheckTransferCaseRecordVo>> getCheckTransferCaseListByCheckIds(@Param("checkIds") String checkIds){
        List<CheckTransferCaseRecordVo> checkTransferCaseList = caseInfoShareService.getCheckTransferCaseListByCheckIds(checkIds);
        return Result.success(Constant.STRING_GET_SUCCESS, checkTransferCaseList);
    }
    /**
     * 描述： 案件信息查询(专项整治-协同调用)
     *
     * @author: zhengqiang
     * @date: 2023/3/16
     * @param: queryOfExtDto
     * @return {@link Result< PageResponse< AllCaseInfoOfExtVo>>}
     **/
    @PostMapping("/getAllCaseInfoListOfExt")
    public Result<PageResponse<AllCaseInfoOfExtVo>> getAllCaseInfoListOfExt(@Validated @RequestBody AllCaseInfoQueryOfExtDto queryOfExtDto){
        List<AllCaseInfoOfExtVo> list = caseInfoShareService.getAllCaseInfoListOfExt(queryOfExtDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(list));
    }
}
